package com.esri.core.internal.io.handler;

import com.esri.core.io.EsriSecurityException;
import com.esri.core.io.EsriServiceException;
import java.io.File;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.net.ssl.SSLException;
import org.apache.http.Header;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.utils.URLEncodedUtils;
import org.codehaus.jackson.JsonParser;

/* loaded from: classes.dex */
public class h extends c {
    private static final long serialVersionUID = 1;

    public static final JsonParser a(String str, Map<String, String> map) throws Exception {
        return a(str, map, 1, (n) null);
    }

    public static final JsonParser a(String str, Map<String, String> map, n nVar) throws Exception {
        return a(str, map, 1, nVar);
    }

    public static final JsonParser b(String str, Map<String, String> map, n nVar) throws Exception {
        return a(str, map, 1, nVar, false);
    }

    public static final JsonParser a(String str, Map<String, String> map, n nVar, boolean z) throws Exception {
        return a(str, map, 1, nVar, z);
    }

    /* JADX WARN: Removed duplicated region for block: B:103:0x0030 A[Catch: EsriServiceException -> 0x0020, HttpResponseException -> 0x0025, SSLException -> 0x0028, TryCatch #3 {HttpResponseException -> 0x0025, EsriServiceException -> 0x0020, SSLException -> 0x0028, blocks: (B:90:0x0014, B:93:0x0019, B:101:0x002c, B:103:0x0030, B:106:0x0038, B:108:0x0040, B:115:0x0055, B:117:0x0086, B:120:0x008f, B:121:0x0092, B:111:0x004a, B:113:0x004e), top: B:168:0x0014 }] */
    /* JADX WARN: Removed duplicated region for block: B:111:0x004a A[Catch: EsriServiceException -> 0x0020, HttpResponseException -> 0x0025, SSLException -> 0x0028, TryCatch #3 {HttpResponseException -> 0x0025, EsriServiceException -> 0x0020, SSLException -> 0x0028, blocks: (B:90:0x0014, B:93:0x0019, B:101:0x002c, B:103:0x0030, B:106:0x0038, B:108:0x0040, B:115:0x0055, B:117:0x0086, B:120:0x008f, B:121:0x0092, B:111:0x004a, B:113:0x004e), top: B:168:0x0014 }] */
    /* JADX WARN: Removed duplicated region for block: B:117:0x0086 A[Catch: EsriServiceException -> 0x0020, HttpResponseException -> 0x0025, SSLException -> 0x0028, TryCatch #3 {HttpResponseException -> 0x0025, EsriServiceException -> 0x0020, SSLException -> 0x0028, blocks: (B:90:0x0014, B:93:0x0019, B:101:0x002c, B:103:0x0030, B:106:0x0038, B:108:0x0040, B:115:0x0055, B:117:0x0086, B:120:0x008f, B:121:0x0092, B:111:0x004a, B:113:0x004e), top: B:168:0x0014 }] */
    /* JADX WARN: Removed duplicated region for block: B:118:0x008c  */
    /* JADX WARN: Removed duplicated region for block: B:120:0x008f A[Catch: EsriServiceException -> 0x0020, HttpResponseException -> 0x0025, SSLException -> 0x0028, TryCatch #3 {HttpResponseException -> 0x0025, EsriServiceException -> 0x0020, SSLException -> 0x0028, blocks: (B:90:0x0014, B:93:0x0019, B:101:0x002c, B:103:0x0030, B:106:0x0038, B:108:0x0040, B:115:0x0055, B:117:0x0086, B:120:0x008f, B:121:0x0092, B:111:0x004a, B:113:0x004e), top: B:168:0x0014 }] */
    /* JADX WARN: Removed duplicated region for block: B:124:0x009b A[Catch: EsriServiceException -> 0x00cd, HttpResponseException -> 0x00cf, SSLException -> 0x00d3, TryCatch #4 {EsriServiceException -> 0x00cd, HttpResponseException -> 0x00cf, SSLException -> 0x00d3, blocks: (B:122:0x0096, B:124:0x009b, B:127:0x00b0, B:129:0x00b6, B:130:0x00bd, B:132:0x00c4, B:135:0x00ca, B:136:0x00cc), top: B:167:0x0096 }] */
    /* JADX WARN: Removed duplicated region for block: B:144:0x00d9  */
    /* JADX WARN: Removed duplicated region for block: B:157:0x010e  */
    /* JADX WARN: Removed duplicated region for block: B:160:0x011b  */
    /* JADX WARN: Removed duplicated region for block: B:162:0x0121  */
    /* JADX WARN: Removed duplicated region for block: B:164:0x0124  */
    /* JADX WARN: Removed duplicated region for block: B:170:? A[RETURN, SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    private static final org.codehaus.jackson.JsonParser a(java.lang.String r18, java.util.Map<java.lang.String, java.lang.String> r19, int r20, com.esri.core.internal.io.handler.n r21, boolean r22) throws java.lang.Exception {
        /*
            Method dump skipped, instructions count: 320
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: com.esri.core.internal.io.handler.h.a(java.lang.String, java.util.Map, int, com.esri.core.internal.io.handler.n, boolean):org.codehaus.jackson.JsonParser");
    }

    /* JADX WARN: Removed duplicated region for block: B:89:0x0052 A[Catch: EsriServiceException -> 0x001e, HttpResponseException -> 0x0021, SSLException -> 0x0024, TryCatch #2 {EsriServiceException -> 0x001e, SSLException -> 0x0024, HttpResponseException -> 0x0021, blocks: (B:64:0x0012, B:67:0x0017, B:75:0x0028, B:77:0x002c, B:79:0x0034, B:82:0x003c, B:84:0x0044, B:91:0x0059, B:93:0x008b, B:95:0x0092, B:98:0x0097, B:99:0x0099, B:87:0x004e, B:89:0x0052), top: B:118:0x0012 }] */
    /* JADX WARN: Removed duplicated region for block: B:93:0x008b A[Catch: EsriServiceException -> 0x001e, HttpResponseException -> 0x0021, SSLException -> 0x0024, TryCatch #2 {EsriServiceException -> 0x001e, SSLException -> 0x0024, HttpResponseException -> 0x0021, blocks: (B:64:0x0012, B:67:0x0017, B:75:0x0028, B:77:0x002c, B:79:0x0034, B:82:0x003c, B:84:0x0044, B:91:0x0059, B:93:0x008b, B:95:0x0092, B:98:0x0097, B:99:0x0099, B:87:0x004e, B:89:0x0052), top: B:118:0x0012 }] */
    /* JADX WARN: Removed duplicated region for block: B:95:0x0092 A[Catch: EsriServiceException -> 0x001e, HttpResponseException -> 0x0021, SSLException -> 0x0024, TryCatch #2 {EsriServiceException -> 0x001e, SSLException -> 0x0024, HttpResponseException -> 0x0021, blocks: (B:64:0x0012, B:67:0x0017, B:75:0x0028, B:77:0x002c, B:79:0x0034, B:82:0x003c, B:84:0x0044, B:91:0x0059, B:93:0x008b, B:95:0x0092, B:98:0x0097, B:99:0x0099, B:87:0x004e, B:89:0x0052), top: B:118:0x0012 }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    private static final org.codehaus.jackson.JsonParser a(java.lang.String r17, java.util.Map<java.lang.String, java.lang.String> r18, int r19, com.esri.core.internal.io.handler.n r20) throws java.lang.Exception {
        /*
            Method dump skipped, instructions count: 242
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: com.esri.core.internal.io.handler.h.a(java.lang.String, java.util.Map, int, com.esri.core.internal.io.handler.n):org.codehaus.jackson.JsonParser");
    }

    public static final JsonParser a(String str, File file, String str2, String str3, n nVar) throws Exception {
        return a(str, file, str2, str3, 1, nVar);
    }

    public static final JsonParser a(String str, File file, String str2, String str3, int i, n nVar) throws Exception {
        return a(str, new i(file, str2, str3), i, nVar);
    }

    public static final JsonParser a(String str, InputStream inputStream, String str2, String str3, String str4, n nVar) throws Exception {
        return a(str, inputStream, str2, str3, str4, 1, nVar);
    }

    public static final JsonParser a(String str, InputStream inputStream, String str2, String str3, String str4, int i, n nVar) throws Exception {
        return a(str, new i(inputStream, str2, str3, str4), i, nVar);
    }

    /* JADX WARN: Removed duplicated region for block: B:76:0x003e A[Catch: EsriServiceException -> 0x0030, HttpResponseException -> 0x0033, SSLException -> 0x0036, TryCatch #2 {EsriServiceException -> 0x0030, SSLException -> 0x0036, HttpResponseException -> 0x0033, blocks: (B:63:0x0024, B:66:0x0029, B:74:0x003a, B:76:0x003e, B:78:0x0044, B:83:0x0055, B:90:0x008e, B:92:0x00a0, B:93:0x00a5, B:95:0x00cd, B:97:0x00d4, B:100:0x00da, B:101:0x00dc, B:86:0x0071, B:89:0x007e, B:79:0x004a, B:82:0x0050), top: B:117:0x0024 }] */
    /* JADX WARN: Removed duplicated region for block: B:79:0x004a A[Catch: EsriServiceException -> 0x0030, HttpResponseException -> 0x0033, SSLException -> 0x0036, TryCatch #2 {EsriServiceException -> 0x0030, SSLException -> 0x0036, HttpResponseException -> 0x0033, blocks: (B:63:0x0024, B:66:0x0029, B:74:0x003a, B:76:0x003e, B:78:0x0044, B:83:0x0055, B:90:0x008e, B:92:0x00a0, B:93:0x00a5, B:95:0x00cd, B:97:0x00d4, B:100:0x00da, B:101:0x00dc, B:86:0x0071, B:89:0x007e, B:79:0x004a, B:82:0x0050), top: B:117:0x0024 }] */
    /* JADX WARN: Removed duplicated region for block: B:85:0x006e  */
    /* JADX WARN: Removed duplicated region for block: B:86:0x0071 A[Catch: EsriServiceException -> 0x0030, HttpResponseException -> 0x0033, SSLException -> 0x0036, TryCatch #2 {EsriServiceException -> 0x0030, SSLException -> 0x0036, HttpResponseException -> 0x0033, blocks: (B:63:0x0024, B:66:0x0029, B:74:0x003a, B:76:0x003e, B:78:0x0044, B:83:0x0055, B:90:0x008e, B:92:0x00a0, B:93:0x00a5, B:95:0x00cd, B:97:0x00d4, B:100:0x00da, B:101:0x00dc, B:86:0x0071, B:89:0x007e, B:79:0x004a, B:82:0x0050), top: B:117:0x0024 }] */
    /* JADX WARN: Removed duplicated region for block: B:92:0x00a0 A[Catch: EsriServiceException -> 0x0030, HttpResponseException -> 0x0033, SSLException -> 0x0036, TryCatch #2 {EsriServiceException -> 0x0030, SSLException -> 0x0036, HttpResponseException -> 0x0033, blocks: (B:63:0x0024, B:66:0x0029, B:74:0x003a, B:76:0x003e, B:78:0x0044, B:83:0x0055, B:90:0x008e, B:92:0x00a0, B:93:0x00a5, B:95:0x00cd, B:97:0x00d4, B:100:0x00da, B:101:0x00dc, B:86:0x0071, B:89:0x007e, B:79:0x004a, B:82:0x0050), top: B:117:0x0024 }] */
    /* JADX WARN: Removed duplicated region for block: B:95:0x00cd A[Catch: EsriServiceException -> 0x0030, HttpResponseException -> 0x0033, SSLException -> 0x0036, TryCatch #2 {EsriServiceException -> 0x0030, SSLException -> 0x0036, HttpResponseException -> 0x0033, blocks: (B:63:0x0024, B:66:0x0029, B:74:0x003a, B:76:0x003e, B:78:0x0044, B:83:0x0055, B:90:0x008e, B:92:0x00a0, B:93:0x00a5, B:95:0x00cd, B:97:0x00d4, B:100:0x00da, B:101:0x00dc, B:86:0x0071, B:89:0x007e, B:79:0x004a, B:82:0x0050), top: B:117:0x0024 }] */
    /* JADX WARN: Removed duplicated region for block: B:97:0x00d4 A[Catch: EsriServiceException -> 0x0030, HttpResponseException -> 0x0033, SSLException -> 0x0036, TryCatch #2 {EsriServiceException -> 0x0030, SSLException -> 0x0036, HttpResponseException -> 0x0033, blocks: (B:63:0x0024, B:66:0x0029, B:74:0x003a, B:76:0x003e, B:78:0x0044, B:83:0x0055, B:90:0x008e, B:92:0x00a0, B:93:0x00a5, B:95:0x00cd, B:97:0x00d4, B:100:0x00da, B:101:0x00dc, B:86:0x0071, B:89:0x007e, B:79:0x004a, B:82:0x0050), top: B:117:0x0024 }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public static final org.codehaus.jackson.JsonParser a(java.lang.String r15, com.esri.core.internal.io.handler.i r16, int r17, com.esri.core.internal.io.handler.n r18) throws java.lang.Exception {
        /*
            Method dump skipped, instructions count: 293
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: com.esri.core.internal.io.handler.h.a(java.lang.String, com.esri.core.internal.io.handler.i, int, com.esri.core.internal.io.handler.n):org.codehaus.jackson.JsonParser");
    }

    public static final JsonParser a(String str, j jVar, int i, n nVar) throws Exception {
        String str2;
        ArrayList arrayList = new ArrayList();
        HashMap hashMap = new HashMap();
        String a = a(str, nVar);
        HttpURLConnection httpURLConnection = null;
        try {
            try {
                c.a(hashMap, nVar);
                c.a(a(hashMap), arrayList);
                StringBuilder sb = new StringBuilder();
                sb.append(c(a));
                if (arrayList.isEmpty()) {
                    str2 = "";
                } else {
                    str2 = "?" + URLEncodedUtils.format(arrayList, "UTF-8");
                }
                sb.append(str2);
                HttpURLConnection a2 = c.a(sb.toString(), jVar.a(), c(nVar));
                try {
                    jVar.b(a2.getOutputStream());
                    b(a2);
                    String a3 = c.a(a2);
                    JsonParser c = com.esri.core.internal.util.d.c(a3);
                    c.nextToken();
                    EsriSecurityException[] esriSecurityExceptionArr = new EsriSecurityException[1];
                    String a4 = c.a(a3, c, a, esriSecurityExceptionArr, i, nVar);
                    if (a4 != null) {
                        JsonParser a5 = a(a4, jVar, i + 1, nVar);
                        if (a2 != null) {
                            a2.disconnect();
                        }
                        return a5;
                    } else if (esriSecurityExceptionArr[0] == null) {
                        if (a2 != null) {
                            a2.disconnect();
                        }
                        return c;
                    } else {
                        throw esriSecurityExceptionArr[0];
                    }
                } catch (HttpResponseException e) {
                    e = e;
                    if (e.getMessage().contains("Unauthorized")) {
                        throw new EsriSecurityException(-10001, EsriSecurityException.HTTP_AUTHENTICATION_FAIL_MESSAGE, e);
                    }
                    throw e;
                } catch (EsriServiceException e2) {
                    e = e2;
                    if (e.getCode() != 401 && !e.getMessage().trim().contains("Unauthorized")) {
                        throw e;
                    }
                    throw new EsriSecurityException(-10001, EsriSecurityException.HTTP_AUTHENTICATION_FAIL_MESSAGE, e);
                } catch (SSLException e3) {
                    e = e3;
                    throw new EsriSecurityException(EsriSecurityException.UNTRUSTED_SERVER_CERTIFICATE, "Untrusted server certificate from " + a, e);
                } catch (Throwable th) {
                    th = th;
                    httpURLConnection = a2;
                    if (httpURLConnection != null) {
                        httpURLConnection.disconnect();
                    }
                    throw th;
                }
            } catch (EsriServiceException e4) {
                e = e4;
            } catch (HttpResponseException e5) {
                e = e5;
            } catch (SSLException e6) {
                e = e6;
            }
        } catch (Throwable th2) {
            th = th2;
        }
    }

    public static final JsonParser a(String str, Map<String, String> map, boolean z, n nVar) throws Exception {
        return a(str, map, z, 1, nVar);
    }

    /* JADX WARN: Removed duplicated region for block: B:57:0x0022 A[Catch: EsriServiceException -> 0x007e, HttpResponseException -> 0x009d, TryCatch #2 {HttpResponseException -> 0x009d, EsriServiceException -> 0x007e, blocks: (B:48:0x000a, B:50:0x0011, B:53:0x0016, B:55:0x001e, B:57:0x0022, B:60:0x002a, B:61:0x002f, B:65:0x003e, B:67:0x006f, B:69:0x0075, B:72:0x007b, B:73:0x007d, B:62:0x0035, B:64:0x0039), top: B:89:0x000a }] */
    /* JADX WARN: Removed duplicated region for block: B:62:0x0035 A[Catch: EsriServiceException -> 0x007e, HttpResponseException -> 0x009d, TryCatch #2 {HttpResponseException -> 0x009d, EsriServiceException -> 0x007e, blocks: (B:48:0x000a, B:50:0x0011, B:53:0x0016, B:55:0x001e, B:57:0x0022, B:60:0x002a, B:61:0x002f, B:65:0x003e, B:67:0x006f, B:69:0x0075, B:72:0x007b, B:73:0x007d, B:62:0x0035, B:64:0x0039), top: B:89:0x000a }] */
    /* JADX WARN: Removed duplicated region for block: B:67:0x006f A[Catch: EsriServiceException -> 0x007e, HttpResponseException -> 0x009d, TryCatch #2 {HttpResponseException -> 0x009d, EsriServiceException -> 0x007e, blocks: (B:48:0x000a, B:50:0x0011, B:53:0x0016, B:55:0x001e, B:57:0x0022, B:60:0x002a, B:61:0x002f, B:65:0x003e, B:67:0x006f, B:69:0x0075, B:72:0x007b, B:73:0x007d, B:62:0x0035, B:64:0x0039), top: B:89:0x000a }] */
    /* JADX WARN: Removed duplicated region for block: B:69:0x0075 A[Catch: EsriServiceException -> 0x007e, HttpResponseException -> 0x009d, TryCatch #2 {HttpResponseException -> 0x009d, EsriServiceException -> 0x007e, blocks: (B:48:0x000a, B:50:0x0011, B:53:0x0016, B:55:0x001e, B:57:0x0022, B:60:0x002a, B:61:0x002f, B:65:0x003e, B:67:0x006f, B:69:0x0075, B:72:0x007b, B:73:0x007d, B:62:0x0035, B:64:0x0039), top: B:89:0x000a }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    private static final org.codehaus.jackson.JsonParser a(java.lang.String r10, java.util.Map<java.lang.String, java.lang.String> r11, boolean r12, int r13, com.esri.core.internal.io.handler.n r14) throws java.lang.Exception {
        /*
            java.lang.String r12 = "Invalid or missing user credentials"
            java.lang.String r0 = "Unauthorized"
            java.lang.String r3 = a(r10, r14)
            r7 = -10001(0xffffffffffffd8ef, float:NaN)
            java.util.ArrayList r1 = new java.util.ArrayList     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            r1.<init>()     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            if (r14 == 0) goto L1d
            com.esri.core.io.UserCredentials r2 = r14.b     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            if (r2 != 0) goto L16
            goto L1d
        L16:
            com.esri.core.io.UserCredentials r2 = r14.b     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            com.esri.core.io.UserCredentials$AuthenticationType r2 = r2.getAuthenticationType()     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            goto L1e
        L1d:
            r2 = 0
        L1e:
            com.esri.core.io.UserCredentials$AuthenticationType r4 = com.esri.core.io.UserCredentials.AuthenticationType.TOKEN     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            if (r2 != r4) goto L35
            java.lang.String r10 = a(r14)     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            if (r10 == 0) goto L3e
            if (r11 != 0) goto L2f
            java.util.HashMap r11 = new java.util.HashMap     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            r11.<init>()     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
        L2f:
            java.lang.String r2 = "token"
            r11.put(r2, r10)     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            goto L3e
        L35:
            com.esri.core.io.UserCredentials$AuthenticationType r4 = com.esri.core.io.UserCredentials.AuthenticationType.HTTP     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            if (r2 != r4) goto L3e
            com.esri.core.io.UserCredentials r2 = r14.b     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            a(r10, r2)     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
        L3e:
            java.util.Map r10 = a(r11)     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            com.esri.core.internal.io.handler.c.a(r10, r1)     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            java.lang.String r10 = c(r14)     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            org.apache.http.client.methods.HttpPost r10 = com.esri.core.internal.io.handler.c.c(r3, r1, r10)     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            org.apache.http.impl.client.DefaultHttpClient r1 = com.esri.core.internal.io.handler.h.f     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            com.esri.core.internal.io.handler.h$3 r2 = new com.esri.core.internal.io.handler.h$3     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            r2.<init>()     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            java.lang.Object r10 = r1.execute(r10, r2)     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            r1 = r10
            java.lang.String r1 = (java.lang.String) r1     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            org.codehaus.jackson.JsonParser r10 = com.esri.core.internal.util.d.c(r1)     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            r10.nextToken()     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            r8 = 1
            com.esri.core.io.EsriSecurityException[] r9 = new com.esri.core.io.EsriSecurityException[r8]     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            r2 = r10
            r4 = r9
            r5 = r13
            r6 = r14
            java.lang.String r1 = com.esri.core.internal.io.handler.c.a(r1, r2, r3, r4, r5, r6)     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            if (r1 == 0) goto L75
            int r13 = r13 + r8
            org.codehaus.jackson.JsonParser r10 = a(r1, r11, r8, r13, r14)     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            return r10
        L75:
            r11 = 0
            r13 = r9[r11]     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            if (r13 != 0) goto L7b
            return r10
        L7b:
            r10 = r9[r11]     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
            throw r10     // Catch: com.esri.core.io.EsriServiceException -> L7e org.apache.http.client.HttpResponseException -> L9d
        L7e:
            r10 = move-exception
            int r11 = r10.getCode()
            r13 = 401(0x191, float:5.62E-43)
            if (r11 == r13) goto L97
            java.lang.String r11 = r10.getMessage()
            java.lang.String r11 = r11.trim()
            boolean r11 = r11.contains(r0)
            if (r11 == 0) goto L96
            goto L97
        L96:
            throw r10
        L97:
            com.esri.core.io.EsriSecurityException r11 = new com.esri.core.io.EsriSecurityException
            r11.<init>(r7, r12, r10)
            throw r11
        L9d:
            r10 = move-exception
            java.lang.String r11 = r10.getMessage()
            boolean r11 = r11.contains(r0)
            if (r11 == 0) goto Lae
            com.esri.core.io.EsriSecurityException r11 = new com.esri.core.io.EsriSecurityException
            r11.<init>(r7, r12, r10)
            throw r11
        Lae:
            throw r10
        */
        throw new UnsupportedOperationException("Method not decompiled: com.esri.core.internal.io.handler.h.a(java.lang.String, java.util.Map, boolean, int, com.esri.core.internal.io.handler.n):org.codehaus.jackson.JsonParser");
    }

    public static final String a(String str, String str2, n nVar, Header[] headerArr) throws Exception {
        if (nVar == null || !(nVar.b instanceof k)) {
            throw new EsriSecurityException(-10001, EsriSecurityException.HTTP_AUTHENTICATION_FAIL_MESSAGE);
        }
        return a(str, str2, 1, nVar, headerArr);
    }

    public static final JsonParser d(String str, Map<String, String> map, n nVar) throws Exception {
        if (nVar == null || !(nVar.b instanceof k)) {
            throw new EsriSecurityException(-10001, EsriSecurityException.HTTP_AUTHENTICATION_FAIL_MESSAGE);
        }
        return b(str, map, 1, nVar);
    }

    public static final JsonParser b(String str, Map<String, String> map) throws Exception {
        return b(str, map, 2, null);
    }

    /* JADX WARN: Removed duplicated region for block: B:61:0x0023 A[Catch: EsriServiceException -> 0x0098, HttpResponseException -> 0x00b7, TryCatch #2 {EsriServiceException -> 0x0098, HttpResponseException -> 0x00b7, blocks: (B:52:0x000a, B:54:0x0012, B:57:0x0017, B:59:0x001f, B:61:0x0023, B:64:0x002b, B:66:0x0033, B:73:0x0048, B:75:0x0088, B:77:0x008f, B:80:0x0095, B:81:0x0097, B:69:0x003d, B:71:0x0041), top: B:97:0x000a }] */
    /* JADX WARN: Removed duplicated region for block: B:69:0x003d A[Catch: EsriServiceException -> 0x0098, HttpResponseException -> 0x00b7, TryCatch #2 {EsriServiceException -> 0x0098, HttpResponseException -> 0x00b7, blocks: (B:52:0x000a, B:54:0x0012, B:57:0x0017, B:59:0x001f, B:61:0x0023, B:64:0x002b, B:66:0x0033, B:73:0x0048, B:75:0x0088, B:77:0x008f, B:80:0x0095, B:81:0x0097, B:69:0x003d, B:71:0x0041), top: B:97:0x000a }] */
    /* JADX WARN: Removed duplicated region for block: B:75:0x0088 A[Catch: EsriServiceException -> 0x0098, HttpResponseException -> 0x00b7, TryCatch #2 {EsriServiceException -> 0x0098, HttpResponseException -> 0x00b7, blocks: (B:52:0x000a, B:54:0x0012, B:57:0x0017, B:59:0x001f, B:61:0x0023, B:64:0x002b, B:66:0x0033, B:73:0x0048, B:75:0x0088, B:77:0x008f, B:80:0x0095, B:81:0x0097, B:69:0x003d, B:71:0x0041), top: B:97:0x000a }] */
    /* JADX WARN: Removed duplicated region for block: B:77:0x008f A[Catch: EsriServiceException -> 0x0098, HttpResponseException -> 0x00b7, TryCatch #2 {EsriServiceException -> 0x0098, HttpResponseException -> 0x00b7, blocks: (B:52:0x000a, B:54:0x0012, B:57:0x0017, B:59:0x001f, B:61:0x0023, B:64:0x002b, B:66:0x0033, B:73:0x0048, B:75:0x0088, B:77:0x008f, B:80:0x0095, B:81:0x0097, B:69:0x003d, B:71:0x0041), top: B:97:0x000a }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    private static final org.codehaus.jackson.JsonParser b(java.lang.String r16, java.util.Map<java.lang.String, java.lang.String> r17, int r18, com.esri.core.internal.io.handler.n r19) throws java.lang.Exception {
        /*
            r0 = r16
            r8 = r19
            java.lang.String r9 = "Invalid or missing credentials"
            java.lang.String r10 = "Unauthorized"
            r11 = -10001(0xffffffffffffd8ef, float:NaN)
            java.util.ArrayList r1 = new java.util.ArrayList     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            r1.<init>()     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            r2 = 0
            if (r8 == 0) goto L1e
            com.esri.core.io.UserCredentials r3 = r8.b     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            if (r3 != 0) goto L17
            goto L1e
        L17:
            com.esri.core.io.UserCredentials r3 = r8.b     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            com.esri.core.io.UserCredentials$AuthenticationType r3 = r3.getAuthenticationType()     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            goto L1f
        L1e:
            r3 = r2
        L1f:
            com.esri.core.io.UserCredentials$AuthenticationType r4 = com.esri.core.io.UserCredentials.AuthenticationType.TOKEN     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            if (r3 != r4) goto L3d
            java.lang.String r3 = a(r19)     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            if (r3 == 0) goto L39
            if (r17 != 0) goto L31
            java.util.HashMap r4 = new java.util.HashMap     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            r4.<init>()     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            goto L33
        L31:
            r4 = r17
        L33:
            java.lang.String r5 = "token"
            r4.put(r5, r3)     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            goto L3b
        L39:
            r4 = r17
        L3b:
            r12 = r4
            goto L48
        L3d:
            com.esri.core.io.UserCredentials$AuthenticationType r4 = com.esri.core.io.UserCredentials.AuthenticationType.HTTP     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            if (r3 != r4) goto L46
            com.esri.core.io.UserCredentials r3 = r8.b     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            a(r0, r3)     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
        L46:
            r12 = r17
        L48:
            java.lang.String r3 = "f"
            java.lang.String r4 = "json"
            r12.put(r3, r4)     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            java.util.Map r3 = a(r12)     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            com.esri.core.internal.io.handler.c.a(r3, r1)     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            org.apache.http.client.methods.HttpPost r1 = com.esri.core.internal.io.handler.c.c(r0, r1, r2)     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            java.lang.String r2 = "Content-Type"
            java.lang.String r3 = "application/x-www-form-urlencoded"
            r1.addHeader(r2, r3)     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            org.apache.http.impl.client.DefaultHttpClient r2 = com.esri.core.internal.io.handler.h.f     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            com.esri.core.internal.io.handler.h$4 r3 = new com.esri.core.internal.io.handler.h$4     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            r3.<init>()     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            java.lang.Object r1 = r2.execute(r1, r3)     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            r2 = r1
            java.lang.String r2 = (java.lang.String) r2     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            org.codehaus.jackson.JsonParser r13 = com.esri.core.internal.util.d.c(r2)     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            r13.nextToken()     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            r14 = 1
            com.esri.core.io.EsriSecurityException[] r15 = new com.esri.core.io.EsriSecurityException[r14]     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            r1 = 0
            r3 = r13
            r4 = r16
            r5 = r15
            r6 = r18
            r7 = r19
            boolean r1 = a(r1, r2, r3, r4, r5, r6, r7)     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            if (r1 == 0) goto L8f
            int r1 = r18 + 1
            org.codehaus.jackson.JsonParser r0 = b(r0, r12, r1, r8)     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            return r0
        L8f:
            r0 = 0
            r1 = r15[r0]     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            if (r1 != 0) goto L95
            return r13
        L95:
            r0 = r15[r0]     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
            throw r0     // Catch: com.esri.core.io.EsriServiceException -> L98 org.apache.http.client.HttpResponseException -> Lb7
        L98:
            r0 = move-exception
            int r1 = r0.getCode()
            r2 = 401(0x191, float:5.62E-43)
            if (r1 == r2) goto Lb1
            java.lang.String r1 = r0.getMessage()
            java.lang.String r1 = r1.trim()
            boolean r1 = r1.contains(r10)
            if (r1 == 0) goto Lb0
            goto Lb1
        Lb0:
            throw r0
        Lb1:
            com.esri.core.io.EsriSecurityException r1 = new com.esri.core.io.EsriSecurityException
            r1.<init>(r11, r9, r0)
            throw r1
        Lb7:
            r0 = move-exception
            java.lang.String r1 = r0.getMessage()
            boolean r1 = r1.contains(r10)
            if (r1 == 0) goto Lc8
            com.esri.core.io.EsriSecurityException r1 = new com.esri.core.io.EsriSecurityException
            r1.<init>(r11, r9, r0)
            throw r1
        Lc8:
            throw r0
        */
        throw new UnsupportedOperationException("Method not decompiled: com.esri.core.internal.io.handler.h.b(java.lang.String, java.util.Map, int, com.esri.core.internal.io.handler.n):org.codehaus.jackson.JsonParser");
    }

    /* JADX WARN: Removed duplicated region for block: B:63:0x0032 A[Catch: EsriServiceException -> 0x008f, HttpResponseException -> 0x00ae, TryCatch #2 {HttpResponseException -> 0x00ae, EsriServiceException -> 0x008f, blocks: (B:49:0x000c, B:51:0x0012, B:53:0x0015, B:54:0x0018, B:56:0x0021, B:59:0x0026, B:61:0x002e, B:63:0x0032, B:67:0x0056, B:69:0x007d, B:71:0x0086, B:74:0x008c, B:75:0x008e, B:64:0x004d, B:66:0x0051), top: B:91:0x000c }] */
    /* JADX WARN: Removed duplicated region for block: B:64:0x004d A[Catch: EsriServiceException -> 0x008f, HttpResponseException -> 0x00ae, TryCatch #2 {HttpResponseException -> 0x00ae, EsriServiceException -> 0x008f, blocks: (B:49:0x000c, B:51:0x0012, B:53:0x0015, B:54:0x0018, B:56:0x0021, B:59:0x0026, B:61:0x002e, B:63:0x0032, B:67:0x0056, B:69:0x007d, B:71:0x0086, B:74:0x008c, B:75:0x008e, B:64:0x004d, B:66:0x0051), top: B:91:0x000c }] */
    /* JADX WARN: Removed duplicated region for block: B:69:0x007d A[Catch: EsriServiceException -> 0x008f, HttpResponseException -> 0x00ae, TryCatch #2 {HttpResponseException -> 0x00ae, EsriServiceException -> 0x008f, blocks: (B:49:0x000c, B:51:0x0012, B:53:0x0015, B:54:0x0018, B:56:0x0021, B:59:0x0026, B:61:0x002e, B:63:0x0032, B:67:0x0056, B:69:0x007d, B:71:0x0086, B:74:0x008c, B:75:0x008e, B:64:0x004d, B:66:0x0051), top: B:91:0x000c }] */
    /* JADX WARN: Removed duplicated region for block: B:71:0x0086 A[Catch: EsriServiceException -> 0x008f, HttpResponseException -> 0x00ae, TryCatch #2 {HttpResponseException -> 0x00ae, EsriServiceException -> 0x008f, blocks: (B:49:0x000c, B:51:0x0012, B:53:0x0015, B:54:0x0018, B:56:0x0021, B:59:0x0026, B:61:0x002e, B:63:0x0032, B:67:0x0056, B:69:0x007d, B:71:0x0086, B:74:0x008c, B:75:0x008e, B:64:0x004d, B:66:0x0051), top: B:91:0x000c }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    private static final java.lang.String a(java.lang.String r16, java.lang.String r17, int r18, com.esri.core.internal.io.handler.n r19, org.apache.http.Header[] r20) throws java.lang.Exception {
        /*
            r0 = r16
            r8 = r19
            r9 = r20
            java.lang.String r10 = "Invalid or missing credentials"
            java.lang.String r11 = "Unauthorized"
            r12 = -10001(0xffffffffffffd8ef, float:NaN)
            org.apache.http.client.methods.HttpPost r1 = com.esri.core.internal.io.handler.c.a(r16, r17)     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            if (r9 == 0) goto L18
            int r2 = r9.length     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            if (r2 <= 0) goto L18
            r1.setHeaders(r9)     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
        L18:
            java.lang.String r2 = "Content-Type"
            java.lang.String r3 = "application/json"
            r1.addHeader(r2, r3)     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            if (r8 == 0) goto L2d
            com.esri.core.io.UserCredentials r2 = r8.b     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            if (r2 != 0) goto L26
            goto L2d
        L26:
            com.esri.core.io.UserCredentials r2 = r8.b     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            com.esri.core.io.UserCredentials$AuthenticationType r2 = r2.getAuthenticationType()     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            goto L2e
        L2d:
            r2 = 0
        L2e:
            com.esri.core.io.UserCredentials$AuthenticationType r3 = com.esri.core.io.UserCredentials.AuthenticationType.TOKEN     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            if (r2 != r3) goto L4d
            java.lang.String r2 = "Authorization"
            java.lang.StringBuilder r3 = new java.lang.StringBuilder     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            r3.<init>()     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            java.lang.String r4 = "Bearer "
            r3.append(r4)     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            java.lang.String r4 = a(r19)     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            r3.append(r4)     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            java.lang.String r3 = r3.toString()     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            r1.addHeader(r2, r3)     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            goto L56
        L4d:
            com.esri.core.io.UserCredentials$AuthenticationType r3 = com.esri.core.io.UserCredentials.AuthenticationType.HTTP     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            if (r2 != r3) goto L56
            com.esri.core.io.UserCredentials r2 = r8.b     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            a(r0, r2)     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
        L56:
            org.apache.http.impl.client.DefaultHttpClient r2 = com.esri.core.internal.io.handler.h.f     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            com.esri.core.internal.io.handler.h$5 r3 = new com.esri.core.internal.io.handler.h$5     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            r3.<init>()     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            java.lang.Object r1 = r2.execute(r1, r3)     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            r13 = r1
            java.lang.String r13 = (java.lang.String) r13     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            org.codehaus.jackson.JsonParser r3 = com.esri.core.internal.util.d.c(r13)     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            r3.nextToken()     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            r14 = 1
            com.esri.core.io.EsriSecurityException[] r15 = new com.esri.core.io.EsriSecurityException[r14]     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            r1 = 1
            r2 = r13
            r4 = r16
            r5 = r15
            r6 = r18
            r7 = r19
            boolean r1 = a(r1, r2, r3, r4, r5, r6, r7)     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            if (r1 == 0) goto L86
            int r1 = r18 + 1
            r2 = r17
            java.lang.String r0 = a(r0, r2, r1, r8, r9)     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            return r0
        L86:
            r0 = 0
            r1 = r15[r0]     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            if (r1 != 0) goto L8c
            return r13
        L8c:
            r0 = r15[r0]     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
            throw r0     // Catch: com.esri.core.io.EsriServiceException -> L8f org.apache.http.client.HttpResponseException -> Lae
        L8f:
            r0 = move-exception
            int r1 = r0.getCode()
            r2 = 401(0x191, float:5.62E-43)
            if (r1 == r2) goto La8
            java.lang.String r1 = r0.getMessage()
            java.lang.String r1 = r1.trim()
            boolean r1 = r1.contains(r11)
            if (r1 == 0) goto La7
            goto La8
        La7:
            throw r0
        La8:
            com.esri.core.io.EsriSecurityException r1 = new com.esri.core.io.EsriSecurityException
            r1.<init>(r12, r10, r0)
            throw r1
        Lae:
            r0 = move-exception
            java.lang.String r1 = r0.getMessage()
            boolean r1 = r1.contains(r11)
            if (r1 == 0) goto Lbf
            com.esri.core.io.EsriSecurityException r1 = new com.esri.core.io.EsriSecurityException
            r1.<init>(r12, r10, r0)
            throw r1
        Lbf:
            throw r0
        */
        throw new UnsupportedOperationException("Method not decompiled: com.esri.core.internal.io.handler.h.a(java.lang.String, java.lang.String, int, com.esri.core.internal.io.handler.n, org.apache.http.Header[]):java.lang.String");
    }

    private static final boolean a(boolean z, String str, JsonParser jsonParser, String str2, EsriSecurityException[] esriSecurityExceptionArr, int i, n nVar) throws Exception {
        EsriServiceException fromJson;
        if (str.length() > 14 && str.substring(0, 15).contains("\"error\"")) {
            if (z) {
                fromJson = EsriServiceException.fromGeotriggerJson(str);
            } else {
                fromJson = EsriServiceException.fromJson(jsonParser);
            }
            if (fromJson.getMessage().trim().contains("Unauthorized access") || fromJson.getCode() == 401 || fromJson.getCode() == 499 || fromJson.getCode() == 403) {
                esriSecurityExceptionArr[0] = new EsriSecurityException(-10001, "Unauthorized access to a secure service - " + str2);
            } else if (fromJson.getCode() != 498) {
                throw fromJson;
            } else {
                if (i < 3) {
                    if (Thread.currentThread().isInterrupted()) {
                        throw new InterruptedException();
                    }
                    a(nVar, i + 1);
                    return true;
                }
                esriSecurityExceptionArr[0] = new EsriSecurityException(EsriSecurityException.TOKEN_INVALID, "Invalid token used to access a secure service - " + str2);
            }
        }
        return false;
    }

    private static final Map<String, String> a(Map<String, String> map) {
        if (map == null) {
            map = new HashMap<>();
        }
        if (!map.containsKey("f")) {
            map.put("f", "json");
        }
        return map;
    }
}
